Class CF.NUR.MNISV3.ProcessesType Extends %Persistent
{

Property ProcessesName As %String(TRUNCATE = 1);

Property ProcessesCode As %String(TRUNCATE = 1);

Property HospitalId As %String(TRUNCATE = 1);

Index Code On (HospitalId, ProcessesCode);

/// d ##class(CF.NUR.MNISV3.ProcessesType).Save("输液","INF",2)
/// d ##class(CF.NUR.MNISV3.ProcessesType).Save("注射","INJ",2)
/// d ##class(CF.NUR.MNISV3.ProcessesType).Save("检验","LAB",2)
ClassMethod Save(Name As %String, Code As %String, HospitalId As %String) As %String
{
	s rw=$o(^CF.NUR.MNISV3.ProcessesTypeI("Code"," "_HospitalId," "_$ZCVT(Code,"U"),""))
	i rw'="" s obj=##class(CF.NUR.MNISV3.ProcessesType).%OpenId(rw)
	e  s obj=##class(CF.NUR.MNISV3.ProcessesType).%New()
	
	s obj.ProcessesName =Name
	s obj.ProcessesCode=Code
	s obj.HospitalId=HospitalId
	d obj.%Save()
	q obj.%Id()
}

ClassMethod DeleteData(rw As %String) As %String
{
	q:rw="" 0
	s a=##class(CF.NUR.MNISV3.ProcessesType).%DeleteId(rw)
	q 1
}

Storage Default
{
<Data name="ProcessesTypeDefaultData">
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>ProcessesName</Value>
</Value>
<Value name="3">
<Value>ProcessesCode</Value>
</Value>
<Value name="4">
<Value>HospitalId</Value>
</Value>
</Data>
<DataLocation>^CF.NUR.MNISV3.ProcessesTypeD</DataLocation>
<DefaultData>ProcessesTypeDefaultData</DefaultData>
<IdLocation>^CF.NUR.MNISV3.ProcessesTypeD</IdLocation>
<IndexLocation>^CF.NUR.MNISV3.ProcessesTypeI</IndexLocation>
<StreamLocation>^CF.NUR.MNISV3.ProcessesTypeS</StreamLocation>
<Type>%Storage.Persistent</Type>
}

}
